<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script type="text/javascript" th:src="@{/lib/jquery/jquery.min.js}" src="../../static/lib/jquery/jquery.min.js"></script>
</head>
<body>
<form>
  <label>
    账号：
    <input type="text" id="username" name="username">
  </label>
  <label>
    密码：
    <input type="password" id="password" name="password">
  </label>
  <button id="login" type="button">登陆</button>
</form>

<script type="text/javascript">
  $(function () {
    $("#login").click(function () {
      $.ajax({
        type:'POST',
        url: '/admin/login',
        dataType: 'json',
        data: {'username':$("#username").val(),'password':$("#password").val()},
        success: function (response) {
          if (response.flag){
            window.location.href = response.data.url;
          }
        }
      })
    })
  })
</script>
</body>
</html>